-- CALC_BS_POLICE_BONUS

-- 计算蓝鲨警官奖励
return function(user, bonusArg)
    local wolfWanted;
    local jasonWanted;
    local frankWanted;
    local ret = {};

    -- 出战的冈布奥
    local petId = ME.user.dbase:query("active_pet");

    -- 血狼通缉令
    if BuildingBonusM.getFieldStat("wolf_wanted") <= 0 then
        wolfWanted = 7552;
    else
        wolfWanted = 7559;
    end
    -- 杰森的通缉令
    if BuildingBonusM.getFieldStat("jason_wanted") < 3 and
       DungeonM.getRandSeed("CALC_BS_POLICE_BONUS") % 100 < 15 then
        jasonWanted = 7553;
    else
        jasonWanted = 7560;
    end
    -- 弗兰克的通缉令
    if BuildingBonusM.getFieldStat("frank_wanted") < 3 and
       DungeonM.getRandSeed("CALC_BS_POLICE_BONUS") % 100 < 15 then
        frankWanted = 7554;
    else
        frankWanted = 7561;
    end

    -- 随机一件警察装备
    local policeEquip = {};

    if petId == 34 then
        policeEquip = { 8241, };
    elseif petId == 44 then
        policeEquip = { 8242, };
    elseif petId == 58 then
        policeEquip = { 8240, };
    else
        policeEquip = { 8240, 8241, 8242, };
    end

    local index = DungeonM.getRandSeed("CALC_BS_POLICE_BONUS") % #policeEquip;
    table.insert(ret, {1, policeEquip[index + 1], 1} );

    -- 根据关卡给通缉令
    local dungeonId = DungeonM.getDungeonId();
    if dungeonId == 20043 then
        if petId ~= 121 then
            table.insert(ret, {1, wolfWanted, 1} );
        end

        if petId == 8 then
            table.insert(ret, {1, jasonWanted, 1} );
            table.insert(ret, {1, frankWanted, 1} );
        else
            if DungeonM.getRandSeed("CALC_BS_POLICE_BONUS") % 2 == 0 then
                table.insert(ret, {1, jasonWanted, 1} );
            else
                table.insert(ret, {1, frankWanted, 1} );
            end
        end
    elseif dungeonId == 20042 then
        if petId ~= 121 then
            table.insert(ret, {1, wolfWanted, 1} );
        end
        table.insert(ret, {1, jasonWanted, 1} );
    else
        if petId ~= 121 then
            table.insert(ret, {1, wolfWanted, 1} );
        end
    end

    -- 齿轮×3
    table.insert(ret, {1, 7550, 3} );

    return ret;
end